package src.cn.itcast.day10.demo05;


/**
 * @author shkstart
 * @create 2020-04-17 15:03
 */
public class Test {
    public static void main(String[] args) {
        Cat c = new Cat();
        Dog d = new Dog();

        showCatEat(c);// 调用showCatEat
        showAnimalEat(c);// 调用showDogEat
        /*
         以上两个方法, 均可以被showAnimalEat(Animal a)方法所替代
         而执行效果一致
         */
        showAnimalEat(d);

    }

    public static void showCatEat (Cat c){
        c.eat();
    }
    public static void showCatEat (Dog d){
        d.eat();
    }
    public static void showAnimalEat (Animal a) {
        a.eat();
    }
}
